package com.cr.web.controller.api;

import com.cr.business.service.ITbProductInfoService;
import com.cr.common.core.domain.AjaxResult;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * 产品信息控制器
 */
@RestController
@RequestMapping("api/product")
public class ProductController {

    @Resource
    private ITbProductInfoService tbProductInfoService;

    /**
     * 获取产品下拉数据
     * @param name 产品名称
     */
    @GetMapping("/getOptionData")
    public AjaxResult getAppOptionData(String name){
        return AjaxResult.success(tbProductInfoService.getAppOptionData(name));
    }

    /**
     * 获取热门产品
     */
    @GetMapping("popularProducts")
    public AjaxResult getPopularProducts(){
        return AjaxResult.success(tbProductInfoService.getPopularProducts());
    }
}
